package com.neusoft.yuejian12.yuejian_12.model;

import com.neusoft.yuejian12.yuejian_12.activity.PostDetailActivity;
import com.neusoft.yuejian12.yuejian_12.javabean.CommentBean;
import com.neusoft.yuejian12.yuejian_12.javabean.PostBean;
import com.neusoft.yuejian12.yuejian_12.service.CommentService;
import com.neusoft.yuejian12.yuejian_12.service.PostService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.neusoft.yuejian12.yuejian_12.constant.Constant.BASE_URL;

/**
 * Created by hp on 2017/10/30.
 */

public class CommentModel {
    private Retrofit retrofit;
    public CommentModel(){
        //创建实例
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    //帖子的评论
    public Call<List<CommentBean>> getCommentList(int p_id){
        CommentService commentService = retrofit.create(CommentService.class);
        return commentService.getPostComment(p_id);

    }

    //发表评论
    public Call<CommentBean> commentPost(int p_id,int u_id,String commentpost){
        CommentService commentService = retrofit.create(CommentService.class);
        return commentService.addComment(p_id,u_id,commentpost);
    }


}
